package org.ice4apps.talk.dao;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * TalkOffice entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "talk_office", catalog = "icetalk")
public class TalkOffice implements java.io.Serializable {
    // Fields
    private String            id;
    private TalkOrganization  talkOrganization;
    private Long              features;
    private Integer           dialPrefix;
    private Long              creationdate;
    private Long              updationdate;
    private Set<TalkUser>     talkUsers     = new HashSet<TalkUser> (0);
    private Set<PublicNumber> publicNumbers = new HashSet<PublicNumber> (0);

    // Constructors
    /** default constructor */
    public TalkOffice () {
    }

    /** minimal constructor */
    public TalkOffice (String id,
                       TalkOrganization talkOrganization,
                       Integer dialPrefix,
                       Long creationdate) {
        this.id = id;
        this.talkOrganization = talkOrganization;
        this.dialPrefix = dialPrefix;
        this.creationdate = creationdate;
    }

    /** full constructor */
    public TalkOffice (String id,
                       TalkOrganization talkOrganization,
                       Long features,
                       Integer dialPrefix,
                       Long creationdate,
                       Long updationdate,
                       Set<TalkUser> talkUsers,
                       Set<PublicNumber> publicNumbers) {
        this.id = id;
        this.talkOrganization = talkOrganization;
        this.features = features;
        this.dialPrefix = dialPrefix;
        this.creationdate = creationdate;
        this.updationdate = updationdate;
        this.talkUsers = talkUsers;
        this.publicNumbers = publicNumbers;
    }

    // Property accessors
    @Id
    @Column(name = "id", unique = true, nullable = false, length = 36)
    public String getId () {
        return this.id;
    }

    public void setId (String id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "organization", nullable = false)
    public TalkOrganization getTalkOrganization () {
        return this.talkOrganization;
    }

    public void setTalkOrganization (TalkOrganization talkOrganization) {
        this.talkOrganization = talkOrganization;
    }

    @Column(name = "features")
    public Long getFeatures () {
        return this.features;
    }

    public void setFeatures (Long features) {
        this.features = features;
    }

    @Column(name = "dial_prefix", nullable = false)
    public Integer getDialPrefix () {
        return this.dialPrefix;
    }

    public void setDialPrefix (Integer dialPrefix) {
        this.dialPrefix = dialPrefix;
    }

    @Column(name = "creationdate", nullable = false)
    public Long getCreationdate () {
        return this.creationdate;
    }

    public void setCreationdate (Long creationdate) {
        this.creationdate = creationdate;
    }

    @Column(name = "updationdate")
    public Long getUpdationdate () {
        return this.updationdate;
    }

    public void setUpdationdate (Long updationdate) {
        this.updationdate = updationdate;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "talkOffice")
    public Set<TalkUser> getTalkUsers () {
        return this.talkUsers;
    }

    public void setTalkUsers (Set<TalkUser> talkUsers) {
        this.talkUsers = talkUsers;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "talkOffice")
    public Set<PublicNumber> getPublicNumbers () {
        return this.publicNumbers;
    }

    public void setPublicNumbers (Set<PublicNumber> publicNumbers) {
        this.publicNumbers = publicNumbers;
    }
}